package com.daoos.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.daoos.swagger.MonitorControllerSnippet;
import com.daoos.swagger.Snippet;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
public class TestController {
	@ApiOperation(value = "get", httpMethod = "GET", response = String.class, notes = "调用test get", produces = MediaType.APPLICATION_JSON_VALUE) // 这是接口的基本信息，不解释，自己看吧
	@Snippet(url = "/test/get", snippetClass = MonitorControllerSnippet.Get.class) // 这是我自己写的，方便spring-restdoc使用的，后面就说
	@ApiImplicitParams({ // 这个是入参，因为入参是request，所以要在这里定义，如果是其它的比如spring或javabean入参，可以在参数上使用@ApiParam注解
			@ApiImplicitParam(name = "Service", value = "服务", required = true, defaultValue = "monitor", dataType = "String"),
			@ApiImplicitParam(name = "Region", value = "机房", required = true, dataType = "String"),
			@ApiImplicitParam(name = "Version", value = "版本", required = true, dataType = "String"),
			@ApiImplicitParam(name = "name", value = "名称", example = "kaddefault", required = true, dataType = "String"),
			@ApiImplicitParam(name = "producttype", value = "产品类型", example = "12", required = true, dataType = "int"),
			@ApiImplicitParam(name = "tags", dataType = "String", example = "{\"port\":8080}") })
	@RequestMapping(path = "/test/get", method = RequestMethod.GET)
	public String get(HttpServletRequest request) {
		System.out.println("进入get");
		return "成功";
	}
}
